<template>
  <div class="swiper">
    <swiper ref="mySwiper" :options="swiperOptions">
      <swiper-slide v-for="item in list" :key="item.id">
        <img class="swiper-img" :src="item.imgUrl" />
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
export default {
  name: 'HomeSwiper',
  props: {
    list: Array
  },
  data: function () {
    return {
      swiperOptions: { // 轮播组件配置https://segmentfault.com/a/1190000014609379
        pagination: {
          autoplay: true,
          speed: 4000,
          el: '.swiper-pagination',
          loop: true
        }
      }
    }
  }
}
</script>

<style lang='stylus' scoped>
.swiper >>> .swiper-pagination
  --swiper-theme-color #fff
.swiper
  overflow hidden
  width 100%
  height 0
  padding-bottom 30.52%
  background #eee
  .swiper-img
    width 100%
</style>
